<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%--el表达式的语法格式：--%>
${表达式}  这个表达式一般是这样子的：域作用对象名称.域中存放的key 或域作用对象名称[域中存放的key]
例如：
<%=request%> <br>
<%
    //这是jsp的写法：
    /*pageContext.setAttribute("msg","page",PageContext.PAGE_SCOPE);
    pageContext.setAttribute("msg","page");
    pageContext.setAttribute("msg","request",PageContext.REQUEST_SCOPE);
    request.setAttribute("msg","request");
    pageContext.setAttribute("msg","session",PageContext.SESSION_SCOPE);
    session.setAttribute("msg","session");
    pageContext.setAttribute("msg","application",PageContext.APPLICATION_SCOPE);
    application.setAttribute("msg","application");*/
%>
<%--${pageContext.request} <br>--%>
<%--这是表达式的写法--%>
<%--${pageContext.setAttribute("msg","page")}--%> //向pageContext域中存放 key-value对：{"msg":"page"}
<%--${pageContext.request.setAttribute("msg","request")}--%>//向request域中存放 key-value对：{"msg":"request"}
<%--${pageContext.session.setAttribute("msg","session")}--%>//向session域中存放 key-value对：{"msg":"session"}
<%--${pageContext.servletContext.setAttribute("msg","application")}--%>//向servletContext域中存放 key-value对：{"msg":"application"}
<hr>
<%--el表达式中有以下四个域作用域对象 它们都 是map对象 --%>
${pageScope} <br>
${requestScope} <br>
${sessionScope} <br>
${applicationScope} <br>
<hr>
<%--用el表达式获取四个域对象 --%>
${pageScope.msg} <br>
${requestScope.msg} <br>
<%--和下面jsp的写法是一样的--%>
<%=request.getAttribute("msg")%> <br>
${sessionScope.msg} <br>
${applicationScope.msg} <br>
<hr>
<%--
用el表达式获取四个域对象 简写 el获取域对象的值顺序：pageContext->request->session->application
 如果最终所有域中都找不到，它不会返回null[<%=request.getAttribute("msg")%> ,它是返回null] 而是返回一个空串 ""
 --%>
${msg} <br>
${msg} <br>
${msg} <br>
${msg} <br>


</body>
</html>
